/*
 * Screen.cpp
 *
 *  Created on: 21-08-2012
 *      Author: szymon
 */

#include "Screen.h"
#include "SurfaceOps.h"
#include <cassert>

Screen::Screen()
{
	//Set up the screen
	screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE);
	assert(screen != NULL);

	//Load background
	background = SurfaceOps::loadImage("background.png");
	assert(background != NULL);

	repaint();
}

Screen::~Screen()
{
	SDL_FreeSurface(screen);
	SDL_FreeSurface(background);
}

void Screen::repaint()
{
	SurfaceOps::applySurface(0, 0, background, screen);
}

SDL_Surface * Screen::surface(void)
{
	return screen;
}

